//
// Created by didi on 2022/8/17.
//
#include <iostream>

#include "configor/json.hpp"
using namespace configor;

struct User {
  std::string name;
  int age;

  // 一行代码完成字段绑定
  CONFIGOR_BIND(json, User, REQUIRED(name), OPTIONAL(age))
};

int main() {
  std::cout << "Hello World!" << std::endl;
  // User 转换到 json
  json j = User{"John", 18};
  // json 转换到 User
  User u = json({{"name", "John"}, {"age", 18}});
  std::cout << j;
  return 0;
}